cmake_minimum_required(VERSION 3.5)
project(DL)
find_package(Threads REQUIRED)
find_package(CUDA 10.0 REQUIRED)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -ggdb -mavx -mssse3 -fopenmp")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --expt-relaxed-constexpr")

include_directories(./include)
add_executable(test_socket example/test_net.cpp)
add_executable(test_avx example/test_avx.cpp)
add_executable(mnist example/mnist.cpp)
add_executable(test_graph example/test_graph.cpp)
add_executable(test_threadpool example/test_threadpool.cpp)
add_executable(test_cuda example/test_cuda.cpp)
add_executable(distributed_mnist example/distributed_mnist.cpp)

target_link_libraries(distributed_mnist Threads::Threads)
target_link_libraries(mnist Threads::Threads)
target_link_libraries(test_graph Threads::Threads)
target_link_libraries(test_threadpool Threads::Threads)

CUDA_ADD_LIBRARY(cuda_support src/cuda_impl/add.cu src/cuda_impl/conv.cu src/cuda_impl/mul.cu)
target_link_libraries(distributed_mnist cuda_support)
target_link_libraries(test_cuda cuda_support)
target_link_libraries(test_graph cuda_support)
target_link_libraries(mnist cuda_support)